package com.telecom.config;

import com.telecom.common.properties.AliOssProperties;
import com.telecom.common.utils.AliOssUtil;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 阿里云OSS配置类
 */
@Configuration
public class AliOssConfiguration {

    @Resource
    private AliOssProperties aliOssProperties;

    /**
     * 创建AliOssUtil对象
     */
    @Bean
    public AliOssUtil aliOssUtil() {
        return new AliOssUtil(
                aliOssProperties.getEndpoint(),
                aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(),
                aliOssProperties.getBucketName()
        );
    }
}